package com.fish.model.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import java.io.Serializable;

/**
 * 用户注册DTO
 */
@Data
@Schema(description = "用户注册请求对象")
public class UserRegisterDTO implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    /**
     * 用户名
     */
    @Schema(description = "用户名（4-20个字符，仅支持字母、数字和下划线）", required = true, example = "testuser")
    @NotBlank(message = "用户名不能为空")
    @Size(min = 4, max = 20, message = "用户名长度必须在4-20个字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "用户名只能包含字母、数字和下划线")
    private String username;
    
    /**
     * 密码
     */
    @Schema(description = "密码（6-20个字符）", required = true, example = "123456")
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间")
    private String password;
    
    /**
     * 确认密码
     */
    @Schema(description = "确认密码（需与密码一致）", required = true, example = "123456")
    @NotBlank(message = "确认密码不能为空")
    private String confirmPassword;
    
    /**
     * 昵称
     */
    @Schema(description = "用户昵称（最多50个字符）", example = "小鱼")
    @Size(max = 50, message = "昵称长度不能超过50个字符")
    private String nickname;
    
    /**
     * 邮箱
     */
    @Schema(description = "邮箱地址", example = "test@example.com")
    @Pattern(regexp = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", 
             message = "邮箱格式不正确")
    private String email;
    
    /**
     * 手机号
     */
    @Schema(description = "手机号码", example = "13800138000")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;
    
    /**
     * 验证码key
     */
    @Schema(description = "验证码唯一标识", example = "abc123")
    private String captchaKey;
    
    /**
     * 验证码
     */
    @Schema(description = "图形验证码", example = "1234")
    private String captchaCode;
}